package edu.uclmgmu.bacteriosec.aspects.oos;

import java.io.ObjectOutputStream;

import edu.uclmgmu.bacteriosec.aspects.common.Store;

privileged aspect OOS_CountCalls {
	void around(java.io.ObjectOutputStream f, byte[] b, int off, int len) : target(f) && args(b, off, len) &&  call(* ObjectOutputStream.write(byte[], int, int)) {
		int counter=Store.get(thisJoinPointStaticPart.getSignature());
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature(), counter++);
		Store.put(thisJoinPointStaticPart.getSignature(), counter);
		proceed(f, b, off, len);
	}
	
	void around(java.io.ObjectOutputStream f, byte[] b) : target(f) && args(b) &&  call(* ObjectOutputStream.write(byte[])) {
		int counter=Store.get(thisJoinPointStaticPart.getSignature());
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature(), counter++);
		Store.put(thisJoinPointStaticPart.getSignature(), counter);
		proceed(f, b);
	}
	
	void around(java.io.ObjectOutputStream f, int n) : target(f) && args(n) &&  call(* ObjectOutputStream.write(int)) {
		int counter=Store.get(thisJoinPointStaticPart.getSignature());
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature(), counter++);
		Store.put(thisJoinPointStaticPart.getSignature(), counter);
		proceed(f, n);
	}
	
	void around(java.io.ObjectOutputStream f, boolean b) : target(f) && args(b) &&  call(* ObjectOutputStream.write(boolean)) {
		int counter=Store.get(thisJoinPointStaticPart.getSignature());
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature(), counter++);
		Store.put(thisJoinPointStaticPart.getSignature(), counter);
		proceed(f, b);
	}
	
	void around(java.io.ObjectOutputStream f, int n) : target(f) && args(n) &&  call(* ObjectOutputStream.writeByte(int)) {
		int counter=Store.get(thisJoinPointStaticPart.getSignature());
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature(), counter++);
		Store.put(thisJoinPointStaticPart.getSignature(), counter);
		proceed(f, n);
	}
	
	void around(java.io.ObjectOutputStream f, String n) : target(f) && args(n) &&  call(* ObjectOutputStream.writeBytes(String)) {
		int counter=Store.get(thisJoinPointStaticPart.getSignature());
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature(), counter++);
		Store.put(thisJoinPointStaticPart.getSignature(), counter);
		proceed(f, n);
	}
	
	void around(java.io.ObjectOutputStream f, int n) : target(f) && args(n) &&  call(* ObjectOutputStream.writeChar(int)) {
		int counter=Store.get(thisJoinPointStaticPart.getSignature());
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature(), counter++);
		Store.put(thisJoinPointStaticPart.getSignature(), counter);
		proceed(f, n);
	}
	
	void around(java.io.ObjectOutputStream f, String n) : target(f) && args(n) &&  call(* ObjectOutputStream.writeChars(String)) {
		int counter=Store.get(thisJoinPointStaticPart.getSignature());
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature(), counter++);
		Store.put(thisJoinPointStaticPart.getSignature(), counter);
		proceed(f, n);
	}
	
	void around(java.io.ObjectOutputStream f, double n) : target(f) && args(n) &&  call(* ObjectOutputStream.writeDouble(double)) {
		int counter=Store.get(thisJoinPointStaticPart.getSignature());
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature(), counter++);
		Store.put(thisJoinPointStaticPart.getSignature(), counter);
		proceed(f, n);
	}
	
	void around(java.io.ObjectOutputStream f, float n) : target(f) && args(n) &&  call(* ObjectOutputStream.writeFloat(float)) {
		int counter=Store.get(thisJoinPointStaticPart.getSignature());
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature(), counter++);
		Store.put(thisJoinPointStaticPart.getSignature(), counter);
		proceed(f, n);
	}
	
	void around(java.io.ObjectOutputStream f, int n) : target(f) && args(n) &&  call(* ObjectOutputStream.writeInt(int)) {
		int counter=Store.get(thisJoinPointStaticPart.getSignature());
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature(), counter++);
		Store.put(thisJoinPointStaticPart.getSignature(), counter);
		proceed(f, n);
	}
	
	void around(java.io.ObjectOutputStream f, long n) : target(f) && args(n) &&  call(* ObjectOutputStream.writeLong(long)) {
		int counter=Store.get(thisJoinPointStaticPart.getSignature());
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature(), counter++);
		Store.put(thisJoinPointStaticPart.getSignature(), counter);
		proceed(f, n);
	}
	
	void around(java.io.ObjectOutputStream f, Object n) : target(f) && args(n) &&  call(* ObjectOutputStream.writeObject(Object)) {
		int counter=Store.get(thisJoinPointStaticPart.getSignature());
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature(), counter++);
		Store.put(thisJoinPointStaticPart.getSignature(), counter);
		proceed(f, n);
	}
	
	void around(java.io.ObjectOutputStream f, String n) : target(f) && args(n) &&  call(* ObjectOutputStream.writeUTF(String)) {
		int counter=Store.get(thisJoinPointStaticPart.getSignature());
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature(), counter++);
		Store.put(thisJoinPointStaticPart.getSignature(), counter);
		proceed(f, n);
	}
}
